package com.cjl.dental_clinic.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cjl.dental_clinic.entity.Doctor;
import com.cjl.dental_clinic.mapper.DoctorMapper;
import com.cjl.dental_clinic.service.DoctorService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @description:
 * @author: cjl
 * @time: 2024/03/12 14:18
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class DoctorServiceImpl extends ServiceImpl<DoctorMapper, Doctor> implements DoctorService {
    @Override
    @Transactional
    public Boolean updateStatus(Integer id) {
        Doctor doctor = baseMapper.selectById(id);
        doctor = doctor.getStatus() == 1 ? doctor.setStatus(2) : doctor.setStatus(1);
        return baseMapper.updateById(doctor)>0;
    }
}
